<template>
  <div class="swiper">
    <swiper indicator-dots autoplay circular>
      <swiper-item v-for="item in swipperList" :key="item.id">
        <img
          class="swiper-img"
          :src="item.imgUrl"
          alt=""
          @click="onPrevImg(item.imgUrl)"
        />
      </swiper-item>
    </swiper>
  </div>
</template>

<script setup>
const props = defineProps({
  swipperList: {
    type: Array,
    default: () => [],
  },
});
const onPrevImg = (url) => {
  uni.previewImage({
    urls: props.swipperList.map((item) => item.imgUrl),
    current: url,
  });
};
</script>

<style lang="scss" scoped>
.swiper {
  width: 100%;
  &-img {
    width: 100%;
    height: 100%;
  }
}
</style>
